#ifndef TRIMATRIX_H_
#define TRIMATRIX_H_

/**
 * The triangular matrix is an n x n element matrix in which the elements
 * a[i,j] and a[j,i], i < n, j < n, are equal. That is, the matrix is
 * 'mirrored' around its major diagonal.
 */
typedef struct 
{
  int n;
  int elem[];
} Trimatrix;

Trimatrix* trimatrix_alloc(int n);
void trimatrix_free(Trimatrix* matrix);
int trimatrix_elem(Trimatrix* matrix, int i, int j);
void trimatrix_set(Trimatrix* matrix, int i, int j, int value);

#endif
